<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>悦慕登录</title>
</head>

<body>

    登录中


    <script src="./js/zepto.js"></script>
    <script src="./js/event.js"></script>
    <script src="./js/touch.js"></script>
    <script src="./js/ajax.js"></script>
    <script src="./js/vconsole.min.js"></script>
    <script>
        // 初始化
        var vConsole = new VConsole();
        console.log('VConsole is cool');
    </script>

    <script>
        $(function () {

            function getUrlParam(url, name) {
                let pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g");
                let matcher = pattern.exec(url);
                let items = null;
                if (matcher != null) {
                    try {
                        items = decodeURIComponent(decodeURIComponent(matcher[1]));
                    } catch (e) {
                        try {
                            items = decodeURIComponent(matcher[1]);
                        } catch (e) {
                            items = matcher[1];
                        }
                    }
                }
                return items;
            }


            var tokenUrl = window.location.href,
                id = localStorage.getItem("userId"),
                url = "http://sda7ka.natappfree.cc/cosmetology/user/tmpLogin/" + id,
                data = {};

            data.code = getUrlParam(tokenUrl, 'code')
            data.id = id

            $.ajax({
                type: 'POST',
                url: url,
                data: data,
                success: function (res) {
                    res = JSON.parse(res);
                    if (res.status == "200") {
                        alert('登录成功')
                    } else {
                        alert(res.msg)
                    }
                }
            })
        })
    </script>
</body>

</html>